package com.ruyuan.eshop.diplomacy.converter;

import com.ruyuan.eshop.diplomacy.domain.bo.ProductDetailBO;
import com.ruyuan.eshop.diplomacy.domain.dto.ProductDetailDTO;
import com.ruyuan.eshop.diplomacy.domain.entity.ProductDetailDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.Collection;
import java.util.List;

/**
 * 商品明细 相关对象克隆
 * @author zhonghuashishan
 * @version 1.0
 */
@Mapper(componentModel = "spring")
public interface ProductDetailConverter {
    /**
     * 集合对象克隆
     * @param doList
     * @return
     */
    List<ProductDetailBO> converterDetailList(Collection<ProductDetailDO> doList);

    /**
     * 对象克隆
     * @param productDetailBO
     * @return
     */
    ProductDetailDTO converterDetail(ProductDetailBO productDetailBO);

    /**
     * 对象克隆
     * @param productDetailDO
     * @return
     */
    @Mappings({
            @Mapping(target = "goodsName", source = "itemName"),
            @Mapping(target = "goodsNo", source = "itemId"),
            @Mapping(target = "goodsStatus", source = "itemStatus"),
            @Mapping(target = "goodsType", source = "itemType"),
    })
    ProductDetailBO converterBO(ProductDetailDO productDetailDO);
}
